use strict;
use JSON qw/to_json/;
use Data::Dumper;

# my $path = 'balloon.nes';
my $path = 'nestest.nes';

open my $f, '<', $path or die $!;
local $/;
my $data = uc( unpack('H*', <$f>) );
my @bytes = grep { $_ } split /(..)/, $data;
my $json = to_json( \@bytes );
print $json;
close $f;

exit 0;